package fun.liuyu2783.txmessage.marketing.mq;

import fun.liuyu2783.txmessage.marketing.dto.Trade;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

// topic需要和生产者的topic一致，consumerGroup属性是必须指定的，内容可以随意
// selectorExpression的意思指的就是tag，默认为“*”，不设置的话会监听所有消息
@Slf4j
@Service
@RocketMQMessageListener(topic = "ORDER_TOPIC", selectorExpression = "confirm", consumerGroup = "Marketing_Order_Confirm_Group", consumeTimeout = 10000)
public class OrderConfirmConsumer implements RocketMQListener<Trade> {


    @Override
    public void onMessage(Trade trade) {
        log.info("接收到订单创建消息：{}", trade);
    }
}